#include "my_delay.h"


void myDelayUs(u16 nus)
{
	u32 cnt;
	cnt = nus;
	TIM_Cmd(TIM7, ENABLE);
	while(cnt--)
	{
		while(TIM_GetFlagStatus(TIM7, TIM_FLAG_Update) == RESET);
		TIM_ClearFlag(TIM7, TIM_FLAG_Update);
	}
	TIM_Cmd(TIM7, DISABLE);
}

void myDelayMs(u16 nms)
{
	u32 cnt;
	cnt = nms*1000;
	TIM_Cmd(TIM7, ENABLE);
	while(cnt--)
	{
		while(TIM_GetFlagStatus(TIM7, TIM_FLAG_Update) == RESET);
		TIM_ClearFlag(TIM7, TIM_FLAG_Update);
	}
	TIM_Cmd(TIM7, DISABLE);
}

